<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" language="javascript">
<!--
	function checkForm(){
		var isRepeat = document.getElementsByName("isRepeat");
		if(isRepeat[0].checked){
			var sign = 0;
			var recordIds = document.getElementsByName("recordId");
			for(var i = 0; i < recordIds.length; i++){
				if(recordIds[i].checked)sign = sign + 1;
			}
			if(sign <= 0){
				alert("<fmt:message key='repeatSet.message.record'/>");
				return false;
			}
		}
		return true;
	}

	function save(){
		if(checkForm()){
			document.repeatCustomerSetForm.action = "./repeatCustomerSet.do?action=saveRepeatCustomerSet";
			document.repeatCustomerSetForm.target = "main";
			document.repeatCustomerSetForm.submit();
		}
	}

	function initPage(){
		var objs = document.getElementsByName("recordId");
		var recordIds = "<c:out value='${repeatSet.recordIds}'/>";
		var ids = recordIds.split(",");
		for(var i = 0; i < ids.length; i++){
			for(var j = 0; j < objs.length; j++){
				if(ids[i] == objs[j].value){
					objs[j].checked = true;
				}
			}
		}
		
		if("<c:out value='${result}'/>" == 1){
			alert("<fmt:message key='common.message.addSuccess'/>");
		}
	}
-->
</script>
</head>
<body onload="initPage()">
<form name="repeatCustomerSetForm" action="" method="post">
	<table class="table_frame">
		<tr>
			<td>
				<table class="table_title1">
					<tr>
						<td class="title_lab" colspan="2">重复客户设置</td>
					</tr>
					<tr>
						<td valign="bottom" class="a_tools" style="padding-left: 3px;">
							<a href="javascript:save();" title="<fmt:message key='common.button.save'/>" hidefocus="true"><fmt:message key='common.button.save'/></a>
						</td>
						<td></td>
					</tr>
					<tr><td height="2"></td></tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table class="table_title2">
					<tr>
						<td class="title_lab">重复控制设置</td>
					</tr>
					<tr>
						<td>
							<table class="table">
								<tr>
									<td valign="top">
										<table class="table_style">
											<tr>
												<td class="title" width="30"><fmt:message key='common.lable.checkbox'/></td>
												<td class="title" width="20%"><fmt:message key='repeatSet.lable.setType'/></td>
												<td class="title"><fmt:message key='repeatSet.lable.desc'/></td>
											</tr>
											<tr>
												<td align="center">
													<input id="isRepeat" name="isRepeat" type="radio" value="0" <c:if test='${repeatSet.isRepeat == 0}'>checked</c:if> />
													<input id="id" name="id" type="hidden" value="${repeatSet.id}"/>
												</td>
												<td><fmt:message key='repeatSet.lable.controller'/></td>
												<td align="left"><fmt:message key='repeatSet.lable.controllerDesc'/></td>
											</tr>
											<tr>
												<td align="center"><input id="isRepeat" name="isRepeat" type="radio" value="1" <c:if test='${repeatSet.isRepeat == 1}'>checked</c:if> /></td>
												<td><fmt:message key='repeatSet.lable.notController'/></td>
												<td align="left"><fmt:message key='repeatSet.lable.notControllerDesc'/></td>
											</tr>
										</table><br><br>
									</td>
								</tr>
								<tr>
									<td class="title_lab">重复判断字段</td>
								</tr>
								<tr>
									<td>
										<table class="table_style">
											<tr>
												<td class="title" width="30"><fmt:message key='common.lable.checkbox'/></td>
												<td class="title" width="20%"><fmt:message key='repeatSet.lable.record'/></td>
												<td class="title"><fmt:message key='repeatSet.lable.recordDesc'/></td>
											</tr>
											<c:forEach var="record" items="${records}">
											<c:if test="${record.recordCode == '12' || record.recordCode == '13' || record.recordCode == '114' || record.recordCode == '14' || record.recordCode == '117' || record.recordCode == '15'}">
											<tr>
												<td align="center"><input id="recordId" name="recordId" type="checkbox" value="${record.id}"/></td>
												<td>
													<c:choose>
														<c:when test="${language == 2}">${record.currentRecordEn}</c:when>
														<c:otherwise>${record.currentRecord}</c:otherwise>
													</c:choose>
												</td>
												<td align="left">
													<c:choose>
														<c:when test="${language == 2}">${record.recordDescEn}</c:when>
														<c:otherwise>${record.recordDesc}</c:otherwise>
													</c:choose>
												</td>
											</tr>
											</c:if>
											</c:forEach>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>
</body>
</html>